
$(function(){

	var name = $(".devname").text();
	var ip = $(".devip").text();
	var mac = $(".devmac").text();


   $(".operation ul li").click(function(event) {
   	 /* Act on the event */
   	  var i = $(this).index();
      var type = $(".operation ul li").eq(i).find("button").attr("bvtype");
      // console.log(type);
      var string = "ajax=&mac="+mac+"&ip="+ip+"&cmdtype="+type;
      jk_send_request_post("/bveth/ControlCommand.html",string,respOperation)
   });

});

function respOperation(data, textStatus) {
    if (textStatus != "success") {
      alert("对不起，操作失败，可能是临时网络原因");
      return false;   
  }
  var result = $.parseJSON(data.responseText);

  switch (result.status) {
      case 0:  // means success
      console.log("opeartion success");
      $(".result-display").html("操作成功");
      break;
    }
}